{include file='../../../PublicView/include.html'}
<script src="/assets/shopmodule/gifts.js"></script>
<div class="taeapp admin-table" cellpadding="0" cellspacing="0" border="0">
        <div class="taeapp admin-table-side  tips tips-small tips-notice tips-no-icon">
            <!--菜单部分-->
            <div class="taeapp admin-nav">
			{include file='../../../PublicView/shopleft.html'}
			</div>
            <!--菜单部分-->
        </div>
        <div class="taeapp admin-table-main">
            <!--内容部分-->
				<ul class="breadcrumb">
					<li><a href="/">互动到店</a> <span class="divider">/</span></li>
					<li>奖品管理 <span class="divider">/</span></li>
					<li class="active">{$title}</li>
				</ul>
		
			<!--内容部分-->
			{if $admin=="jifen"}
			<div class="button-group" style="margin: 9px 0;">
			  <a class="button" href="/?c=jifen&amp;m=shopadmin">积分配置</a>
			  <a class="button" href="/?c=jifen&a=user&m=shopadmin">兑换记录</a>
			  <a class="button" href="/?c=jifen&a=qiandao&m=shopadmin">签到记录</a>
			  <a class="button" href="/?c=jifen&a=jforders&m=shopadmin">订单换积分</a>
			</div>
			{/if}
			{include file='../../../PublicView/showmessage.html'}
			<div class="row">
			  <div id="tab">
					 <ul class="bui-tab nav-tabs">
					 {if $admin=="wins" ||$admin=="jifen"}
					 <form class="pull-right" method="post" action="{if $admin=="wins"}/?c=wins&m=shopadmin{else}/?c=jifen&a=user&m=shopadmin{/if}">
						<input type="text" name="usernick" value="{$search|default:""}" class="control-text search-query">
						<button type="submit" class="button-small">搜索</button>
					 </form>
					 {/if}
					 <li class="bui-tab-item {if $ctp=="all"} bui-tab-item-selected{/if}" data-admin="{$admin}" data-tp="all"><span class="bui-tab-item-text">全部</span></li>
					 {foreach from=$tools key=key item=item}
					 {if $item.status}
					 <li class="bui-tab-item {if $ctp==$key} bui-tab-item-selected{/if}" data-admin="{$admin}" data-tp="{$key}"><span class="bui-tab-item-text">{$item.name}</span></li>
					 {/if}
					 {/foreach}
					 {if $admin!="wins" && $admin!="jifen"}
					 <li><button class="button button-small button-success add" data-ctp="{$ctp}">添加奖品</button></li>
					 {if $type==9}
					 <li class="pull-right"><button class="button button-small button-success list" data-ctp="{$ctp}"><i class="icon icon-white icon-list"></i>列表</button></li>
					 {else}
					 <li class="pull-right"><button class="button button-small button-warning trash" data-ctp="{$ctp}"><i class="icon icon-white icon-trash"></i>回收站</button></li>
					 {/if}
					 {/if}
					 {if $admin=="wins"|| $admin=="jifen"}
					 <li><a class="button button-small button-success" style="padding:2px 5px" href="/?a=giftlist_download&c=wins&m=shopadmin">导出</a></li>
					 <li><button class="button button-small button-success js-reset">清空</button></li>
					 {/if}
					 <!-- <li><button class="button button-small button-danger"><i class="icon-white icon-trash"></i>删除内容</button></li>
					 <li><button class="button button-small button-inverse">修改内容</button></li> --></ul>
			  </div>
			  <div class="form-horizontal">
			  <table cellspacing="0" class="table table-bordered" style="border-top:none">
          <tbody>
            <tr>
              <th width="15"></th>
              <th>名称</th>
              <th width="60">等级</th>
			  {if $admin!="wins" && $admin !="jifen"}
              <th width="30">概率</th>
			  {/if}
              <th width="30">数量</th>
              <th width="30">价值</th>
              <th width="60">类型</th>
			  {if $admin=="wins" || $admin=="jifen"}
			  <th width="50">中奖人</th>
			  <th width="50">时间</th>
			  <th width="52">状态</th>
			  <th width="52">来源</th>
			  {/if}
            </tr>
		  {foreach key=key item=item from=$data}
            <tr class="re{$ctp}{$item.id}">
              <td>{if $current == 'shopgift'}<input type="checkbox" data-gid="{$item.id}" class="js-select">{/if}</td>
			  <td>
			  <a href="{$item.num_iids}"  target="_blank" title="{$item.toolname}{$item.giftid}" >{$item.name}</a> 
			  <i class="pull-right">
			  {if $admin!="wins" && $admin !="jifen"}
			  <button class="button button-mini edit fa{$item.id}" data-gid="{$item.id}" data-gtp="{$ctp}" data-unick="{$item.usernick|default:""}">
			  <i class="icon icon-pencil"></i>修改
			  </button>
			  <span class=" curpoint x-icon x-icon-small x-icon-error js-delete" style="cursor:pointer" data-gid="{$item.id}">×</span>
			  {else}
				{if $item.status==0}<button class="button button-mini js-fajiang fa{$item.id}" data-gid="{$item.id}" data-gtp="{$ctp}" data-unick="{$item.usernick|default:""}">
				<i class="icon icon-pencil"></i>发奖
				</button>
				{/if}
				{if $item.type=="实物" && $item.status==1}
					已发奖
				{/if}
			  {/if}
			  </i>
			  </td>
              <td>{$item.level}</td>
			  {if $admin!="wins" && $admin !="jifen"}
              <td>{$item.probability}</td>
			  {/if}
			  {if $admin!="wins" && $admin !="jifen"}
			  <td>{$item.quantity}</td>
			  {else}
			  <td>{$item.ugq}份</td>
			  {/if}
			  <td>{$item.price}元</td>
			  <td>
				{$item.type}
			  </td>
			   {if $admin=="wins" || $admin =="jifen"}
			  <td>{if !$item.usernick}{$item.mixednick|default:"错误！"|truncate:8:"..."}{else}{$item.usernick|default:""}{/if}</td>
			  <td>{$item.actiontime}</td>
              <td class="status{$item.gid}">
				  {if $item.status==0}<span class="label label-info">未发奖</span>{/if}
			      {if $item.status==1}
					{if $item.type=="实物"}
					<button class="button button-mini button-success js-checkwl" data-gid="{$key}">查看</button>
					{else}
					<span class="label label-success">已发奖</span>
					{/if}
				  {/if}
			      {if $item.status==2}<span class="label">已领取</span>{/if}
			      {if $item.status==3}<span class="label label-warning">催发奖</span>{/if}
				  {if $item.status==9}<span class="label label-inverse"><del>拒绝发奖</del></span>{/if}
				  {if $item.status==11}<span class="label label-info">尚未开始</span>{/if}
				  {if $item.status==12}<span class="label label-success">正在进行</span>{/if}
				  {if $item.status==13}<span class="label label-inverse">已经结束</span>{/if}
			  </td>
			  <td>{$item.getway}</td>
			  {/if}
            </tr>
		{/foreach}
          </tbody>
        </table>
		<div>
		  {if $admin!="wins" && $admin !="jifen"}
          <ul class="toolbar pull-left">
            <li><label class="checkbox"><input type="checkbox" class="js-checkall"><a href="###" class="js-checkall">全选</a></label></li>
            <li><button class="button button-success js-edit-all"><i class="icon-white icon-trash"></i>批量修改</button></li>
           <!--  <li><button class="button button-danger">审核通过</button></li>
            <li><button class="button button-inverse">审核不通过</button></li> -->
          </ul>
		  {/if}
		  <div class="pagination pull-right" data-totalpg="{$totalpg}" data-curpg="{$curpg}" data-action="{$current}">
			{$page}
          </div>
        </div>
			  </div>
			</div>			
			<input type="hidden" class="type" value="{$type|default:0}" />
        <!--内容部分-->
        </div>
</div>